function updataAnnounce(id, publisher, titile, notice_content, notice_date) {
    document.getElementById("divSeeAnnouncementTitle").innerText="编辑公告";
    document.getElementById("AnnouncementId").value = id;
    document.getElementById("AnnouncementTitle").value = titile;
    document.getElementById("AnnouncementContent").value = notice_content;
    document.getElementById("AnnouncementFooterPublisher").value = publisher;
    document.getElementById("addOrUpdateAnnoucementForm").action = "Announcement?op=2";
    document.getElementById("divSeeAnnouncement").setAttribute("style", " display: block;");

    // document.getElementById("addAnnoucementForm").submit();
    // alert(publisher)
}

function addAnnounce(publisher) {
    // alert(publisher)
    document.getElementById("divSeeAnnouncementTitle").innerText="添加公告";
    document.getElementById("AnnouncementId").value = '';
    document.getElementById("AnnouncementTitle").value = '';
    document.getElementById("AnnouncementContent").value = '';
    document.getElementById("AnnouncementFooterPublisher").value = publisher;
    document.getElementById("addOrUpdateAnnoucementForm").action = "Announcement?op=0";
    document.getElementById("divSeeAnnouncement").setAttribute("style", " display: block;");

    // document.getElementById("addOrUpdataAnnoucementForm").submit();
    // alert(publisher)
}

//删除公告
function subToServlet(id) {
    if (id == null || id.length <= 0) {
        alert("获取公告id失败！")
        return;
    }
    document.getElementById("divAnnouncement").value = id;
    document.getElementById("deleteAnnoucementForm").submit();
}

//关闭编辑窗
function closeAnnouncement() {
    document.getElementById("divSeeAnnouncement").setAttribute("style", " display: none;");

}

//保存公告
function saveAnnouncement(form) {
    if(document.getElementById("AnnouncementTitle").value.length<=0)
    {
        alert("标题不可为空！");
        return false;
    }
    if(document.getElementById("AnnouncementContent").value.length<=0)
    {
        alert("内容不可为空！");
        return false;
    }
    return true;
}

function tipToView(add,del,update) {

    if(add!=null && add!=''){
        if(add=='true'){
            alert("添加成功！")
        }else {
            alert("添加失败！")
        }
    }
    if(del!=null&& del!=''){
        if(del=='true'){
            alert("删除成功！")
        }else {
            alert("删除失败！")
        }
    }
    if(update!=null&& update!=''){
        if(update=='true'){
            alert("更新成功!")
        }else {
            alert("更新失败！")
        }
    }
    // alert(add+":"+del+":"+update);

}
